package org.scratchcrew.domain;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "t_scratch_files")
@AttributeOverrides(value = { @AttributeOverride(column = @Column(name = "scratch_file_id"), name = "id") })
public class ScratchFile extends BaseEntity {

	@ManyToOne(optional = false)
	@JoinColumn(nullable = false, name = "board_id")
	private Board board;

	@Lob
	@Column(name = "scratch_file", nullable = false)
	private byte[] scratchFile;

	@Column(name = "mime_type", nullable = false)
	private String mimeType;

	@Column(name = "file_name", nullable = false)
	private String fileName;

	@Column(name = "last_modified_date", nullable = false)
	private long lastModifiedDate;

	public byte[] getScratchFile() {
		return scratchFile;
	}

	public void setScratchFile(byte[] scratchFile) {
		this.scratchFile = scratchFile;
	}

	public String getMimeType() {
		return mimeType;
	}

	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}

	public Board getBoard() {
		return board;
	}

	public void setBoard(Board board) {
		this.board = board;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public long getLastModifiedDate() {
		return lastModifiedDate;
	}

	public void setLastModifiedDate(long lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}
}
